\hypertarget{mmc__hal_8c}{}\section{fatfs.\+hal/mmc\+\_\+hal.c File Reference}
\label{mmc__hal_8c}\index{fatfs.\+hal/mmc\+\_\+hal.\+c@{fatfs.\+hal/mmc\+\_\+hal.\+c}}
{\ttfamily \#include \char`\"{}user\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}printf/mathio.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}lib/time.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}lib/timer.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}fatfs.\+sup/fatfs.\+h\char`\"{}}\\*
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{mmc__hal_8c_a3371d3911fed5af510a9b6e313773171}{mmc\+\_\+task} (void)
\begin{DoxyCompactList}\small\item\em 1000\+HZ timer task \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{mmc__hal_8c_a35434a6e722b07d8fee213c2256391be}{mmc\+\_\+install\+\_\+timer} (void)
\begin{DoxyCompactList}\small\item\em Install M\+MC timer task\+: \hyperlink{mmc__hal_8c_a3371d3911fed5af510a9b6e313773171}{mmc\+\_\+task()} \end{DoxyCompactList}\item 
void \hyperlink{mmc__hal_8c_ae9d8b33ee8fd54f03d5d6946d6022df9}{mmc\+\_\+spi\+\_\+init} ()
\begin{DoxyCompactList}\small\item\em M\+MC S\+PI setup and chip select. \end{DoxyCompactList}\item 
void \hyperlink{mmc__hal_8c_a6baca506fd7fb368a968a82e9093b4a0}{mmc\+\_\+spi\+\_\+begin} ()
\begin{DoxyCompactList}\small\item\em M\+MC S\+PI setup and chip select. \end{DoxyCompactList}\item 
void \hyperlink{mmc__hal_8c_a3ef82f5ac21c4adcf55addccf88f3d5a}{mmc\+\_\+spi\+\_\+end} ()
\begin{DoxyCompactList}\small\item\em M\+MC S\+PI end and chip deselect. \end{DoxyCompactList}\item 
void \hyperlink{mmc__hal_8c_a120c1501f6694e4947cb37f09679dda9}{mmc\+\_\+slow} ()
\begin{DoxyCompactList}\small\item\em M\+MC set slow S\+PI bus speed Only called when deselected. \end{DoxyCompactList}\item 
void \hyperlink{mmc__hal_8c_a7d41efb1efa51ca4c815ee275553ecae}{mmc\+\_\+fast} ()
\begin{DoxyCompactList}\small\item\em M\+MC fast S\+PI bus speed Only called when deselected. \end{DoxyCompactList}\item 
void \hyperlink{mmc__hal_8c_a850895a4f23c495249a3074fd2dafbcb}{mmc\+\_\+spi\+\_\+\+T\+X\+\_\+buffer} (const \hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} $\ast$data, int count)
\begin{DoxyCompactList}\small\item\em S\+PI write buffer. \end{DoxyCompactList}\item 
void \hyperlink{mmc__hal_8c_ac5b4aae5665fe63d3d0a280215f759f8}{mmc\+\_\+spi\+\_\+\+R\+X\+\_\+buffer} (const \hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} $\ast$data, int count)
\begin{DoxyCompactList}\small\item\em S\+PI read buffer. \end{DoxyCompactList}\item 
\hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} \hyperlink{mmc__hal_8c_a8f6b7c1f3819cd4bd2aa114c8ebb7f19}{mmc\+\_\+spi\+\_\+\+T\+X\+RX} (\hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} data)
\begin{DoxyCompactList}\small\item\em S\+PI read and write 1 byte. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{mmc__hal_8c_a95af3dbb0e5e0a16710138786c29fb4f}{mmc\+\_\+set\+\_\+ms\+\_\+timeout} (\hyperlink{send_8c_a273cf69d639a59973b6019625df33e30}{uint16\+\_\+t} ms)
\begin{DoxyCompactList}\small\item\em Set M\+MC timeout timer in Milliseconds. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{mmc__hal_8c_a7383533f1b6630ff4f0337f400b4b62e}{mmc\+\_\+test\+\_\+timeout} ()
\begin{DoxyCompactList}\small\item\em Wait for timeout. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{mmc__hal_8c_abb3b85d2e3abc4df68487df05510bb55}{mmc\+\_\+ms\+\_\+wait} (int ms)
\begin{DoxyCompactList}\small\item\em Wait for time in milliseconds. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{mmc__hal_8c_ad417477e66c88b40dcce683fd6a5c47a}{mmc\+\_\+init} (int verbose)
\begin{DoxyCompactList}\small\item\em Initialize M\+MC and Fat\+Fs interface, display diagnostics. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{mmc__hal_8c_a5ebdcf7dd5b0f47163d20481a5d09e00}{mmc\+\_\+power\+\_\+on} ()
\begin{DoxyCompactList}\small\item\em M\+MC Power ON. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{mmc__hal_8c_af1357b405b44e70bd22a537e67fc56db}{mmc\+\_\+power\+\_\+off} ()
\begin{DoxyCompactList}\small\item\em M\+MC Power O\+FF. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{mmc__hal_8c_a76337667431fa723bc6d50503a52f8e0}{mmc\+\_\+ins\+\_\+status} ()
\begin{DoxyCompactList}\small\item\em M\+MC Card Inserted status. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{mmc__hal_8c_acbc9faece423623a86f62b50ac59b312}{mmc\+\_\+wp\+\_\+status} ()
\begin{DoxyCompactList}\small\item\em M\+MC Card Write Protect status. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hyperlink{diskio_8h_adba6790898ce4029c20a34b898ce73c1}{D\+S\+T\+A\+T\+US} \hyperlink{mmc__hal_8c_a5e05b0c3f7ba56fa9c23be08c497eb9f}{Stat}
\item 
\hyperlink{send_8c_a273cf69d639a59973b6019625df33e30}{uint16\+\_\+t} \hyperlink{mmc__hal_8c_abf71973875545f3b42702ac99d5d87ef}{\+\_\+mmc\+\_\+timeout} = 0
\begin{DoxyCompactList}\small\item\em M\+MC timeout counter in ms. \end{DoxyCompactList}\item 
\hyperlink{send_8c_a435d1572bf3f880d55459d9805097f62}{uint32\+\_\+t} \hyperlink{mmc__hal_8c_a72ddc159b1a36ffda342f0f2d5c144f4}{\+\_\+mmc\+\_\+clock} = 0
\begin{DoxyCompactList}\small\item\em M\+MC S\+PI C\+L\+O\+CK cache. \end{DoxyCompactList}\item 
\hyperlink{send_8c_a273cf69d639a59973b6019625df33e30}{uint16\+\_\+t} \hyperlink{mmc__hal_8c_adc0a07c5ad80e8ecbabee0cf04a1564e}{\+\_\+mmc\+\_\+pre} = 0
\item 
static int \hyperlink{mmc__hal_8c_a530d484dee6be1fc954f32f677add7c4}{mmc\+\_\+init\+\_\+flag} = 0
\begin{DoxyCompactList}\small\item\em has the M\+MC interface been initialized yet ? \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function Documentation}
\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+fast@{mmc\+\_\+fast}}
\index{mmc\+\_\+fast@{mmc\+\_\+fast}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+fast()}{mmc_fast()}}]{\setlength{\rightskip}{0pt plus 5cm}void mmc\+\_\+fast (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a7d41efb1efa51ca4c815ee275553ecae}{}\label{mmc__hal_8c_a7d41efb1efa51ca4c815ee275553ecae}


M\+MC fast S\+PI bus speed Only called when deselected. 


\begin{DoxyItemize}
\item Used during normal file IO phases \begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}

\end{DoxyItemize}

Definition at line 123 of file mmc\+\_\+hal.\+c.

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+init@{mmc\+\_\+init}}
\index{mmc\+\_\+init@{mmc\+\_\+init}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+init(int verbose)}{mmc_init(int verbose)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int mmc\+\_\+init (
\begin{DoxyParamCaption}
\item[{int}]{verbose}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_ad417477e66c88b40dcce683fd6a5c47a}{}\label{mmc__hal_8c_ad417477e66c88b40dcce683fd6a5c47a}


Initialize M\+MC and Fat\+Fs interface, display diagnostics. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em verbose} & display initialisation messages \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\end{DoxyReturn}


Definition at line 208 of file mmc\+\_\+hal.\+c.



Referenced by fatfs\+\_\+tests(), open(), and setup().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+ins\+\_\+status@{mmc\+\_\+ins\+\_\+status}}
\index{mmc\+\_\+ins\+\_\+status@{mmc\+\_\+ins\+\_\+status}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+ins\+\_\+status()}{mmc_ins_status()}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int mmc\+\_\+ins\+\_\+status (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a76337667431fa723bc6d50503a52f8e0}{}\label{mmc__hal_8c_a76337667431fa723bc6d50503a52f8e0}


M\+MC Card Inserted status. 


\begin{DoxyItemize}
\item We do not detect card insert status in this project. \begin{DoxyReturn}{Returns}
1 card inserted 
\end{DoxyReturn}

\end{DoxyItemize}

Definition at line 300 of file mmc\+\_\+hal.\+c.

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+install\+\_\+timer@{mmc\+\_\+install\+\_\+timer}}
\index{mmc\+\_\+install\+\_\+timer@{mmc\+\_\+install\+\_\+timer}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+install\+\_\+timer(void)}{mmc_install_timer(void)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void mmc\+\_\+install\+\_\+timer (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a35434a6e722b07d8fee213c2256391be}{}\label{mmc__hal_8c_a35434a6e722b07d8fee213c2256391be}


Install M\+MC timer task\+: \hyperlink{mmc__hal_8c_a3371d3911fed5af510a9b6e313773171}{mmc\+\_\+task()} 

\begin{DoxySeeAlso}{See also}
\hyperlink{mmc__hal_8c_a3371d3911fed5af510a9b6e313773171}{mmc\+\_\+task()} 
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 79 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+init().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+ms\+\_\+wait@{mmc\+\_\+ms\+\_\+wait}}
\index{mmc\+\_\+ms\+\_\+wait@{mmc\+\_\+ms\+\_\+wait}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+ms\+\_\+wait(int ms)}{mmc_ms_wait(int ms)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void mmc\+\_\+ms\+\_\+wait (
\begin{DoxyParamCaption}
\item[{int}]{ms}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_abb3b85d2e3abc4df68487df05510bb55}{}\label{mmc__hal_8c_abb3b85d2e3abc4df68487df05510bb55}


Wait for time in milliseconds. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em ms} & timeout in Milliseconds \\
\hline
\end{DoxyParams}


Definition at line 194 of file mmc\+\_\+hal.\+c.

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+power\+\_\+off@{mmc\+\_\+power\+\_\+off}}
\index{mmc\+\_\+power\+\_\+off@{mmc\+\_\+power\+\_\+off}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+power\+\_\+off()}{mmc_power_off()}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void mmc\+\_\+power\+\_\+off (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_af1357b405b44e70bd22a537e67fc56db}{}\label{mmc__hal_8c_af1357b405b44e70bd22a537e67fc56db}


M\+MC Power O\+FF. 

\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 290 of file mmc\+\_\+hal.\+c.



Referenced by power\+\_\+off().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+power\+\_\+on@{mmc\+\_\+power\+\_\+on}}
\index{mmc\+\_\+power\+\_\+on@{mmc\+\_\+power\+\_\+on}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+power\+\_\+on()}{mmc_power_on()}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void mmc\+\_\+power\+\_\+on (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a5ebdcf7dd5b0f47163d20481a5d09e00}{}\label{mmc__hal_8c_a5ebdcf7dd5b0f47163d20481a5d09e00}


M\+MC Power ON. 

\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 282 of file mmc\+\_\+hal.\+c.



Referenced by power\+\_\+on().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+set\+\_\+ms\+\_\+timeout@{mmc\+\_\+set\+\_\+ms\+\_\+timeout}}
\index{mmc\+\_\+set\+\_\+ms\+\_\+timeout@{mmc\+\_\+set\+\_\+ms\+\_\+timeout}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+set\+\_\+ms\+\_\+timeout(uint16\+\_\+t ms)}{mmc_set_ms_timeout(uint16_t ms)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void mmc\+\_\+set\+\_\+ms\+\_\+timeout (
\begin{DoxyParamCaption}
\item[{{\bf uint16\+\_\+t}}]{ms}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a95af3dbb0e5e0a16710138786c29fb4f}{}\label{mmc__hal_8c_a95af3dbb0e5e0a16710138786c29fb4f}


Set M\+MC timeout timer in Milliseconds. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em ms} & timeout in Milliseconds \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{mmc__hal_8c_a7383533f1b6630ff4f0337f400b4b62e}{mmc\+\_\+test\+\_\+timeout} ( ) 
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 161 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+disk\+\_\+initialize(), mmc\+\_\+disk\+\_\+read(), mmc\+\_\+ms\+\_\+wait(), rcvr\+\_\+datablock(), and wait\+\_\+ready().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+slow@{mmc\+\_\+slow}}
\index{mmc\+\_\+slow@{mmc\+\_\+slow}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+slow()}{mmc_slow()}}]{\setlength{\rightskip}{0pt plus 5cm}void mmc\+\_\+slow (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a120c1501f6694e4947cb37f09679dda9}{}\label{mmc__hal_8c_a120c1501f6694e4947cb37f09679dda9}


M\+MC set slow S\+PI bus speed Only called when deselected. 


\begin{DoxyItemize}
\item Used during card detect phase \begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}

\end{DoxyItemize}

Definition at line 113 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+spi\+\_\+init().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+spi\+\_\+begin@{mmc\+\_\+spi\+\_\+begin}}
\index{mmc\+\_\+spi\+\_\+begin@{mmc\+\_\+spi\+\_\+begin}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+spi\+\_\+begin()}{mmc_spi_begin()}}]{\setlength{\rightskip}{0pt plus 5cm}void mmc\+\_\+spi\+\_\+begin (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a6baca506fd7fb368a968a82e9093b4a0}{}\label{mmc__hal_8c_a6baca506fd7fb368a968a82e9093b4a0}


M\+MC S\+PI setup and chip select. 

\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 97 of file mmc\+\_\+hal.\+c.

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+spi\+\_\+end@{mmc\+\_\+spi\+\_\+end}}
\index{mmc\+\_\+spi\+\_\+end@{mmc\+\_\+spi\+\_\+end}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+spi\+\_\+end()}{mmc_spi_end()}}]{\setlength{\rightskip}{0pt plus 5cm}void mmc\+\_\+spi\+\_\+end (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a3ef82f5ac21c4adcf55addccf88f3d5a}{}\label{mmc__hal_8c_a3ef82f5ac21c4adcf55addccf88f3d5a}


M\+MC S\+PI end and chip deselect. 

\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 104 of file mmc\+\_\+hal.\+c.

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+spi\+\_\+init@{mmc\+\_\+spi\+\_\+init}}
\index{mmc\+\_\+spi\+\_\+init@{mmc\+\_\+spi\+\_\+init}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+spi\+\_\+init()}{mmc_spi_init()}}]{\setlength{\rightskip}{0pt plus 5cm}void mmc\+\_\+spi\+\_\+init (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_ae9d8b33ee8fd54f03d5d6946d6022df9}{}\label{mmc__hal_8c_ae9d8b33ee8fd54f03d5d6946d6022df9}


M\+MC S\+PI setup and chip select. 

\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 88 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+init().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+spi\+\_\+\+R\+X\+\_\+buffer@{mmc\+\_\+spi\+\_\+\+R\+X\+\_\+buffer}}
\index{mmc\+\_\+spi\+\_\+\+R\+X\+\_\+buffer@{mmc\+\_\+spi\+\_\+\+R\+X\+\_\+buffer}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+spi\+\_\+\+R\+X\+\_\+buffer(const uint8\+\_\+t $\ast$data, int count)}{mmc_spi_RX_buffer(const uint8_t *data, int count)}}]{\setlength{\rightskip}{0pt plus 5cm}void mmc\+\_\+spi\+\_\+\+R\+X\+\_\+buffer (
\begin{DoxyParamCaption}
\item[{const {\bf uint8\+\_\+t} $\ast$}]{data, }
\item[{int}]{count}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_ac5b4aae5665fe63d3d0a280215f759f8}{}\label{mmc__hal_8c_ac5b4aae5665fe63d3d0a280215f759f8}


S\+PI read buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$data} & transmit buffer \\
\hline
\mbox{\tt in}  & {\em count} & number of bytes to write \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 142 of file mmc\+\_\+hal.\+c.



Referenced by rcvr\+\_\+spi\+\_\+multi().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+spi\+\_\+\+T\+X\+\_\+buffer@{mmc\+\_\+spi\+\_\+\+T\+X\+\_\+buffer}}
\index{mmc\+\_\+spi\+\_\+\+T\+X\+\_\+buffer@{mmc\+\_\+spi\+\_\+\+T\+X\+\_\+buffer}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+spi\+\_\+\+T\+X\+\_\+buffer(const uint8\+\_\+t $\ast$data, int count)}{mmc_spi_TX_buffer(const uint8_t *data, int count)}}]{\setlength{\rightskip}{0pt plus 5cm}void mmc\+\_\+spi\+\_\+\+T\+X\+\_\+buffer (
\begin{DoxyParamCaption}
\item[{const {\bf uint8\+\_\+t} $\ast$}]{data, }
\item[{int}]{count}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a850895a4f23c495249a3074fd2dafbcb}{}\label{mmc__hal_8c_a850895a4f23c495249a3074fd2dafbcb}


S\+PI write buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$data} & transmit buffer \\
\hline
\mbox{\tt in}  & {\em count} & number of bytes to write \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 133 of file mmc\+\_\+hal.\+c.



Referenced by xmit\+\_\+spi\+\_\+multi().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+spi\+\_\+\+T\+X\+RX@{mmc\+\_\+spi\+\_\+\+T\+X\+RX}}
\index{mmc\+\_\+spi\+\_\+\+T\+X\+RX@{mmc\+\_\+spi\+\_\+\+T\+X\+RX}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+spi\+\_\+\+T\+X\+R\+X(uint8\+\_\+t data)}{mmc_spi_TXRX(uint8_t data)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf uint8\+\_\+t} mmc\+\_\+spi\+\_\+\+T\+X\+RX (
\begin{DoxyParamCaption}
\item[{{\bf uint8\+\_\+t}}]{data}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a8f6b7c1f3819cd4bd2aa114c8ebb7f19}{}\label{mmc__hal_8c_a8f6b7c1f3819cd4bd2aa114c8ebb7f19}


S\+PI read and write 1 byte. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em data} & value to transmit \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
uint8\+\_\+t value read 
\end{DoxyReturn}


Definition at line 150 of file mmc\+\_\+hal.\+c.



Referenced by xchg\+\_\+spi().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+task@{mmc\+\_\+task}}
\index{mmc\+\_\+task@{mmc\+\_\+task}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+task(void)}{mmc_task(void)}}]{\setlength{\rightskip}{0pt plus 5cm}static void mmc\+\_\+task (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{mmc__hal_8c_a3371d3911fed5af510a9b6e313773171}{}\label{mmc__hal_8c_a3371d3911fed5af510a9b6e313773171}


1000\+HZ timer task 

\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 59 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+install\+\_\+timer().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+test\+\_\+timeout@{mmc\+\_\+test\+\_\+timeout}}
\index{mmc\+\_\+test\+\_\+timeout@{mmc\+\_\+test\+\_\+timeout}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+test\+\_\+timeout()}{mmc_test_timeout()}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int mmc\+\_\+test\+\_\+timeout (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_a7383533f1b6630ff4f0337f400b4b62e}{}\label{mmc__hal_8c_a7383533f1b6630ff4f0337f400b4b62e}


Wait for timeout. 

\begin{DoxyReturn}{Returns}
1 ready 

0 timeout 
\end{DoxyReturn}


Definition at line 172 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+disk\+\_\+initialize(), mmc\+\_\+disk\+\_\+read(), mmc\+\_\+ms\+\_\+wait(), rcvr\+\_\+datablock(), and wait\+\_\+ready().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+wp\+\_\+status@{mmc\+\_\+wp\+\_\+status}}
\index{mmc\+\_\+wp\+\_\+status@{mmc\+\_\+wp\+\_\+status}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+wp\+\_\+status()}{mmc_wp_status()}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int mmc\+\_\+wp\+\_\+status (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{mmc__hal_8c_acbc9faece423623a86f62b50ac59b312}{}\label{mmc__hal_8c_acbc9faece423623a86f62b50ac59b312}


M\+MC Card Write Protect status. 


\begin{DoxyItemize}
\item We do not detect card write protect status in this project. \begin{DoxyReturn}{Returns}
0 == not write protected 
\end{DoxyReturn}

\end{DoxyItemize}

Definition at line 313 of file mmc\+\_\+hal.\+c.



\subsection{Variable Documentation}
\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!\+\_\+mmc\+\_\+clock@{\+\_\+mmc\+\_\+clock}}
\index{\+\_\+mmc\+\_\+clock@{\+\_\+mmc\+\_\+clock}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{\+\_\+mmc\+\_\+clock}{_mmc_clock}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf uint32\+\_\+t} \+\_\+mmc\+\_\+clock = 0}\hypertarget{mmc__hal_8c_a72ddc159b1a36ffda342f0f2d5c144f4}{}\label{mmc__hal_8c_a72ddc159b1a36ffda342f0f2d5c144f4}


M\+MC S\+PI C\+L\+O\+CK cache. 



Definition at line 50 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+fast(), mmc\+\_\+slow(), and mmc\+\_\+spi\+\_\+begin().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!\+\_\+mmc\+\_\+pre@{\+\_\+mmc\+\_\+pre}}
\index{\+\_\+mmc\+\_\+pre@{\+\_\+mmc\+\_\+pre}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{\+\_\+mmc\+\_\+pre}{_mmc_pre}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf uint16\+\_\+t} \+\_\+mmc\+\_\+pre = 0}\hypertarget{mmc__hal_8c_adc0a07c5ad80e8ecbabee0cf04a1564e}{}\label{mmc__hal_8c_adc0a07c5ad80e8ecbabee0cf04a1564e}


Definition at line 53 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+task().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!\+\_\+mmc\+\_\+timeout@{\+\_\+mmc\+\_\+timeout}}
\index{\+\_\+mmc\+\_\+timeout@{\+\_\+mmc\+\_\+timeout}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{\+\_\+mmc\+\_\+timeout}{_mmc_timeout}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf uint16\+\_\+t} \+\_\+mmc\+\_\+timeout = 0}\hypertarget{mmc__hal_8c_abf71973875545f3b42702ac99d5d87ef}{}\label{mmc__hal_8c_abf71973875545f3b42702ac99d5d87ef}


M\+MC timeout counter in ms. 



Definition at line 47 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+install\+\_\+timer(), mmc\+\_\+set\+\_\+ms\+\_\+timeout(), mmc\+\_\+task(), and mmc\+\_\+test\+\_\+timeout().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!mmc\+\_\+init\+\_\+flag@{mmc\+\_\+init\+\_\+flag}}
\index{mmc\+\_\+init\+\_\+flag@{mmc\+\_\+init\+\_\+flag}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{mmc\+\_\+init\+\_\+flag}{mmc_init_flag}}]{\setlength{\rightskip}{0pt plus 5cm}int mmc\+\_\+init\+\_\+flag = 0\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{mmc__hal_8c_a530d484dee6be1fc954f32f677add7c4}{}\label{mmc__hal_8c_a530d484dee6be1fc954f32f677add7c4}


has the M\+MC interface been initialized yet ? 



Definition at line 202 of file mmc\+\_\+hal.\+c.



Referenced by mmc\+\_\+init().

\index{mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}!Stat@{Stat}}
\index{Stat@{Stat}!mmc\+\_\+hal.\+c@{mmc\+\_\+hal.\+c}}
\subsubsection[{\texorpdfstring{Stat}{Stat}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf D\+S\+T\+A\+T\+US} Stat}\hypertarget{mmc__hal_8c_a5e05b0c3f7ba56fa9c23be08c497eb9f}{}\label{mmc__hal_8c_a5e05b0c3f7ba56fa9c23be08c497eb9f}


Definition at line 79 of file mmc.\+c.



Referenced by mmc\+\_\+disk\+\_\+initialize(), mmc\+\_\+disk\+\_\+read(), mmc\+\_\+disk\+\_\+status(), mmc\+\_\+disk\+\_\+timerproc(), mmc\+\_\+init(), and mmc\+\_\+test\+\_\+timeout().

